package net.qunzhi.modules.app.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.qunzhi.common.utils.PageUtils;
import net.qunzhi.common.utils.R;
import net.qunzhi.modules.app.annotation.Login;
import net.qunzhi.modules.cms.query.StateDateQuery;
import net.qunzhi.modules.cms.service.TbElectricityStateService;
import net.qunzhi.modules.cms.service.TbFlowStateService;
import net.qunzhi.modules.cms.service.TbPressureStateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "App线上数据相关")
@RestController
@RequestMapping("app/stateData")
public class AppStateDataController {
    @Autowired
    private TbFlowStateService flowStateService;
    @Autowired
    private TbPressureStateService pressureStateService;
    @Autowired
    private TbElectricityStateService electricityStateService;

    /**
     * 列表
     */
    @Login
    @ApiOperation("流量列表")
    @GetMapping("/flowList")
    public R flowList(StateDateQuery query){
        PageUtils page = flowStateService.queryPage(query);

        return R.ok().put("page", page);
    }

    @Login
    @ApiOperation("压力列表")
    @GetMapping("/pressureList")
    public R pressureList(StateDateQuery query){
        PageUtils page = pressureStateService.queryPage(query);

        return R.ok().put("page", page);
    }

    @Login
    @ApiOperation("电力列表")
    @GetMapping("/electricityList")
    public R electricityList(StateDateQuery query){
        PageUtils page = electricityStateService.queryPage(query);

        return R.ok().put("page", page);
    }

}
